package sk.fritz.megafonsms.formmodel;

public class InputFormControl extends AbstractFormControl {
	
	public final static int TYPE_TEXT = 1;
	public final static int TYPE_PASSWORD = 2;
	public final static int TYPE_CHECKBOX = 3;
	public final static int TYPE_RADIO = 4;
	public final static int TYPE_SUBMIT = 5;
	public final static int TYPE_RESET = 6;
	public final static int TYPE_FILE = 7;
	public final static int TYPE_HIDDEN = 8;
	public final static int TYPE_IMAGE = 9;
	public final static int TYPE_BUTON = 10;
	public final static int TYPE_TEXTAREA = 11;
	
	
	private int type;
	
	
	private Integer maxLength;

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Integer getMaxLength() {
		return maxLength;
	}

	public void setMaxLength(Integer maxLength) {
		this.maxLength = maxLength;
	}
	
	public static int parseType(String type) {
		if (type.equals("text")) 
			return TYPE_TEXT;
		else if (type.equals("password")) 
			return TYPE_PASSWORD;
		else if (type.equals("checkbox"))
			return TYPE_CHECKBOX;
		else if (type.equals("hidden"))
			return TYPE_HIDDEN;
		else if (type.equals("textarea"))
			return TYPE_TEXTAREA;
		else return -1; // TODO :)
	}
	
	// TODO: several other attributes which I dont need right now ...
	
	
}
